#ifndef EMINTERGRID_H
#define EMINTERGRID_H

#include "Core/Tensor.h"
#include "FiniteDiff/Intergrid.h"
#include "Embedded/EmbeddedGrid.h"

template <int Dim>
class EmIntergrid : public Intergrid<Dim>
{
public:
  using iVec = Vec<int, Dim>;
  using EmGrid = EmbeddedGrid<Dim>;

  EmIntergrid(const EmGrid &aCoarseGrid, const EmGrid &aFineGrid)
      : Intergrid<Dim>(aCoarseGrid, aFineGrid), coarseEmGrid(aCoarseGrid), fineEmGrid(aFineGrid)
  {
  }

  void restrictResidual(const Tensor<Real,Dim> &fineData, Tensor<Real,Dim> &coarseData) const;

  void incrementalProlong(const Tensor<Real,Dim> &coarseData, Tensor<Real,Dim> &fineData) const;

protected:
  const EmGrid &coarseEmGrid;
  const EmGrid &fineEmGrid;
};

#endif //EMINTERGRID_H
